<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>on</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<body>
  <div id="div">
    <!--v-on:click---绑定点击事件
        @click---缩写模式
    -->
    <button v-on:click="isShow">隐藏</button>
    <button @click="isShow">显示</button>

    <img v-show="flag" src="img/1.jpg">

    <input type="text" @keydown.C="a">
  </div>
</body>
  <script>
    new Vue({
      el: "#div",
      data: {
        flag: true
      },
      methods: {
        isShow(){
          this.flag = !this.flag;
        },
        a(event){
          if (event.keyCode >= 'a' && event.keyCode <= 'z'){
            console.log("按下了按钮")
          }
        }
      }
    });
  </script>
</html>